package com.eam.controller;

import com.eam.service.EquipmentinformationCheckService;
import com.yy.base.page.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;


@Controller
@RequestMapping("processReport")
public class EquipmentinformationController {
	@Autowired
	private EquipmentinformationCheckService processReportService;
	
//	//初始化工序产量统计页面的数据
//	@ResponseBody
//	@RequestMapping(value="initProcessReportInfo",method=RequestMethod.POST)
//	public Map<String,Object> initProcessReportInfo(){
//		return processReportService.initProcessReportInfo();
//	}
	
	//查询工序产量报表数据
	@ResponseBody
	@RequestMapping(value="searchProcessReport",method=RequestMethod.POST)
	public Message searchProcessReport(HttpServletRequest request){
		Message msg = new Message();	
		List<Map<String, Object>> aa = processReportService.initProcessReportInfo();
		msg.setData("processList",aa);
		msg.setData("counts",processReportService.countsProcessopr());
		msg.setData("information",processReportService.searchProcessReport());
		
//		List<Map<String, Object>> aa = processReportService.initProcessReportInfo();
//		
//		
//		List<Map<String, Object>> bb = processReportService.countsProcessopr();
//		
//		for(int i = 0; i<bb.size() ; i++){
//			List<Map<String, Object>> cc = processReportService.countsProcessopr();
//			String gxnmae = cc.get(0).get("GXNAME").toString();
//		}
//		msg.setData("processList",aa);
//		msg.setData("counts",bb);
//		msg.setData("information",processReportService.searchProcessReport());
		return msg;
		
	}
	
	//查询工序在制数量统计数据
	@ResponseBody
	@RequestMapping(value="searchProcessInQtyReport",method=RequestMethod.POST)
	public List<Map<String,Object>> searchProcessInQtyReport(String processId,String manuDate){
		return processReportService.searchProcessInQtyReport(processId,manuDate);
	}
		
}
